package train48days;

public class 年终奖 {
    public int getMost(int[][] board) {
        int row = board.length;
        int col = board[0].length;
//        for (int i = 1; i <row; i++) {
//            board[i][0] = board[i-1][0];
//        }
//        for (int i = 1; i <col ; i++) {
//            board[0][i] = board[0][i-1];
//        }
        for (int i = 0; i < row; i++) {
            for (int j = 0; j < col; j++) {
                if(i==0&&j==0){
                }else if (i==0){
                    board[0][j] += board[0][j-1];
                }else if (j==0){
                    board[i][0] += board[i-1][0];
                }else {
                    board[i][j] += Math.max(board[i-1][j],board[i][j-1]);
                }
            }
        }
        return board[row-1][col-1];
    }
}
